import { _decorator, Component, instantiate, Node, Prefab, UITransform } from 'cc';
import { Card } from './Card';
import { CardTemplate } from './CardTemplate';

const { ccclass, property } = _decorator;

@ccclass('StackCards')
export class StackCards extends Component {



    cardNodes: Node[] = []

    start() {


    }

    init(nodes: Node[], index: number) {

        for (let i = 0; i < nodes.length; i++) {
         
            const cardTemplate: CardTemplate = nodes[index].getComponent(CardTemplate)
            switch (index) {
                case 0:
                    cardTemplate.direction = 'self'
                    break;
                case 1:
                    cardTemplate.direction = 'after'
                    break;
                case 2:
                    cardTemplate.direction = 'face'
                    break;
                case 3:
                    cardTemplate.direction = 'font'
                    break;
            }

            this.node.addChild(nodes[i])
        }
    }


    update(deltaTime: number) {

    }
}


